Configure Web Options

Source code

Copy code
'************************************************************************************************************************
'Description:
'
'This example opens UFT One and configures its Web options.
'
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtWebOptions 'As QuickTest.WebOptions ' Declare the Web Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.SetActiveAddins Array("Web") ' Activate the Web Add-in
qtApp.Launch ' Start UFT One
qtApp.Visible = True ' Make the UFT One application visible
qtApp.Open "C:\Tests\Test1", False 'Open a test so that you use the Web property to return the Web Options object

Set qtWebOptions = qtApp.Options.Web ' Return the Web Options object

' Configure the Web options
qtWebOptions.AddToPageLoadTime = 30 ' Set the time added to page load time to 30 seconds

' Configure advanced Web options
qtWebOptions.EnableBrowserResize = False ' Set to open the browser to its default size
qtWebOptions.RunUsingSourceIndex = True ' Set to use the source index property (for better performance)
qtWebOptions.UseAutoXPathIdentifiers = True ' Instruct UFT One to learn and use an XPath property during a run session
qtWebOptions.RunOnlyClick = True ' Set to run click events as MouseDown, MouseUp and Click
qtWebOptions.BrowserCleanup = True ' Set to close all open browsers when test/iteration finishes
qtWebOptions.RecordByWinMouseEvents = "OnClick OnMouseDown" ' Indicate for which events to use standard Windows events
qtWebOptions.RecordAllNavigations = True ' Set to record navigation each time the URL changes
qtWebOptions.RecordMouseDownAndUpAsClick = False ' Set to record MouseDown and MouseUp instead of Clicks
qtWebOptions.RecordCoordinates = False ' Instruct UFT One not to record actual coordinates
If qtWebOptions.PageCreationMode = "URL" Then ' If optimizing Page object creation is currently selected (URL mode) then
    qtWebOptions.CreatePageUsingNonUserData = "Get" ' Instruct UFT One to ignore non-user data if using Get transfer method
    qtWebOptions.CreatePageUsingUserData = "Get Post" ' Instruct UFT One to ignore user data if using Get/Post transfer method
    qtWebOptions.CreatePageUsingAdditionalInfo = False ' Instruct UFT One to not to use additional properties to identify existing Page
End If
If qtWebOptions.FrameCreationMode = "URL" Then ' If optimizing Frame object creation is currently selected (URL mode) then
    qtWebOptions.CreateFrameUsingNonUserData = "Get" ' Instruct UFT One to ignore non-user data if using Get transfer method
    qtWebOptions.CreateFrameUsingUserData = "Get Post" ' Instruct UFT One to ignore user data if using Get/Post transfer method
    qtWebOptions.CreateFrameUsingAdditionalInfo = False ' Instruct UFT One to not to use additional properties to identify existing Frame
End If

Set qtWebOptions = Nothing ' Release the Web Options object
Set qtApp = Nothing ' Release the Application object